Optimal. Leaf size=90 \[ \frac {2 b (A b-a B) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 d \sqrt {a-b} \sqrt {a+b}}-\frac {x (A b-a B)}{a^2}+\frac {A \sin (c+d x)}{a d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.15, antiderivative size = 90, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.172, Rules used = {4034, 12, 3783, 2659, 208} \[ \frac {2 b (A b-a B) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 d \sqrt {a-b} \sqrt {a+b}}-\frac {x (A b-a B)}{a^2}+\frac {A \sin (c+d x)}{a d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 208
Rule 2659
Rule 3783
Rule 4034
Rubi steps
\begin {align*} \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{a+b \sec (c+d x)} \, dx &=\frac {A \sin (c+d x)}{a d}-\frac {\int \frac {A b-a B}{a+b \sec (c+d x)} \, dx}{a}\\ &=\frac {A \sin (c+d x)}{a d}-\frac {(A b-a B) \int \frac {1}{a+b \sec (c+d x)} \, dx}{a}\\ &=-\frac {(A b-a B) x}{a^2}+\frac {A \sin (c+d x)}{a d}+\frac {(A b-a B) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{a^2}\\ &=-\frac {(A b-a B) x}{a^2}+\frac {A \sin (c+d x)}{a d}+\frac {(2 (A b-a B)) \operatorname {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^2 d}\\ &=-\frac {(A b-a B) x}{a^2}+\frac {2 b (A b-a B) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 \sqrt {a-b} \sqrt {a+b} d}+\frac {A \sin (c+d x)}{a d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.23, size = 85, normalized size = 0.94 \[ \frac {-\frac {2 b (A b-a B) \tanh ^{-1}\left (\frac {(b-a) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}+(c+d x) (a B-A b)+a A \sin (c+d x)}{a^2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.48, size = 328, normalized size = 3.64 \[ \left [\frac {2 \, {\left (B a^{3} - A a^{2} b - B a b^{2} + A b^{3}\right )} d x - {\left (B a b - A b^{2}\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) + 2 \, {\left (A a^{3} - A a b^{2}\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{4} - a^{2} b^{2}\right )} d}, \frac {{\left (B a^{3} - A a^{2} b - B a b^{2} + A b^{3}\right )} d x - {\left (B a b - A b^{2}\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) + {\left (A a^{3} - A a b^{2}\right )} \sin \left (d x + c\right )}{{\left (a^{4} - a^{2} b^{2}\right )} d}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.92, size = 141, normalized size = 1.57 \[ \frac {\frac {{\left (B a - A b\right )} {\left (d x + c\right )}}{a^{2}} + \frac {2 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )} a} - \frac {2 \, {\left (B a b - A b^{2}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{\sqrt {-a^{2} + b^{2}} a^{2}}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 1.25, size = 172, normalized size = 1.91 \[ \frac {2 b^{2} \arctanh \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right ) A}{d \,a^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {2 b \arctanh \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right ) B}{d a \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {2 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d a \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}-\frac {2 A \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b}{d \,a^{2}}+\frac {2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) B}{a d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 3.36, size = 740, normalized size = 8.22 \[ \frac {2\,A\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,\left (a^4-a^2\,b^2\right )}+\frac {2\,B\,a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,\left (a^4-a^2\,b^2\right )}+\frac {A\,a^3\,\sin \left (c+d\,x\right )}{d\,\left (a^4-a^2\,b^2\right )}-\frac {A\,a\,b^2\,\sin \left (c+d\,x\right )}{d\,\left (a^4-a^2\,b^2\right )}+\frac {A\,b^2\,\mathrm {atan}\left (\frac {-a^5\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,1{}\mathrm {i}+b^3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,{\left (a^2-b^2\right )}^{3/2}\,2{}\mathrm {i}+b^5\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,2{}\mathrm {i}-a^2\,b^3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,3{}\mathrm {i}+a^3\,b^2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,1{}\mathrm {i}+a^4\,b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^6-2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^4\,b^2+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2\,b^4}\right )\,\sqrt {a^2-b^2}\,2{}\mathrm {i}}{d\,\left (a^4-a^2\,b^2\right )}-\frac {2\,A\,a^2\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,\left (a^4-a^2\,b^2\right )}-\frac {2\,B\,a\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,\left (a^4-a^2\,b^2\right )}-\frac {B\,a\,b\,\mathrm {atan}\left (\frac {-a^5\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,1{}\mathrm {i}+b^3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,{\left (a^2-b^2\right )}^{3/2}\,2{}\mathrm {i}+b^5\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,2{}\mathrm {i}-a^2\,b^3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,3{}\mathrm {i}+a^3\,b^2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,1{}\mathrm {i}+a^4\,b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^6-2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^4\,b^2+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2\,b^4}\right )\,\sqrt {a^2-b^2}\,2{}\mathrm {i}}{d\,\left (a^4-a^2\,b^2\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\left (A + B \sec {\left (c + d x \right )}\right ) \cos {\left (c + d x \right )}}{a + b \sec {\left (c + d x \right )}}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________